import axios from 'axios'

/**
 * get请求
 * @param url
 * @param header
 * @param params
 * @param successFun
 * @param failFun
 */
export function doGet (url, header, params, successFun, failFun) {
  if (header) {
    header.token = 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIzIiwiZXhwIjoxNjg2MjgyMjIyLCJpYXQiOjE2ODYxOTU4MjJ9.KtiI6F6MaIzw4H2uGzCMfu6Tamoxf8MPBcUZDIuxznV6XFln7sGbYeZBkTvZ45_Rr7lZM3AJ9BleKnmh5SBR6g'
  }
  axios.get(url, {
    params: params,
    headers: header
  }).then((res) => {
    if (res.status === 200) {
      successFun({res: res.data, header: res.headers})
    } else {
      failFun({res: res.data, header: res.headers})
    }
  })
}
